<!DOCTYPE html>
<html>
<head>
     <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>产品列表</title> 
    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="/public/static/admin/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/public/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/public/static/admin/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/public/static/admin/css/animate.css" rel="stylesheet">
    <link href="/public/static/admin/css/style.css?v=4.0.0" rel="stylesheet">
    <link href="/public/static/admin/js/plugins/layer/skin/layer.css" rel="stylesheet">
    <base target="_blank">
    <!-- 全局js -->
    <script src="/public/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/public/static/admin/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="/public/static/admin/js/plugins/layer/layer.min.js"></script>

    <!-- 自定义js -->
    <script src="/public/static/admin/js/content.js?v=1.0.0"></script>
    <script src="/public/static/admin/js/contabs.js"></script>
    <script src="/public/static/admin/js/common.js"></script>
    <script src="/public/static/admin/js/article.js"></script>
    <script src="/public/static/admin/js/myAjax.js"></script>

    <!-- Bootstrap table -->
    <script src="/public/static/admin/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/public/static/admin/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script src="/public/static/admin/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>  

</head>

<body>
<div class="wrapper">
  <!-- Main content -->
  <section class="content">
    <div class="container-fluid">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title"><i class="fa fa-list"></i> 属性组列表</h3>
        </div>
        <div class="panel-body">    
		<div class="navbar navbar-default">
            <div class="row navbar-form"><!--onclick="location.href='{:url('Admin/goods/addEditGoodsType')}'"-->
                <button type="button" onclick="add()"   class="btn btn-primary pull-right"><i class="fa fa-plus"></i>新增属性组</button>
            </div>
          </div>
                        
          <div id="ajax_return"> 
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <th class="sorting text-center">ID</th>                                
                                <th class="sorting text-center">属性组名</th>
                                <th class="sorting text-center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="goodsTypeList" id="list"}
                                <tr>
                                    <td class="text-center">{$list.id}</td>
                                    <td class="text-center">{$list.name}</td>
                                    <td class="text-center">
										<a href="{:url('Admin/Product/goodsAttributeList',array('type_id'=>$list['id']))}" data-toggle="tooltip" title="查看列表" class="btn btn-info" data-original-title="属性列表" target="_self"><i class="fa fa-eye"></i></a>
                                        <!--<a href="{:url('Admin/goods/addEditGoodsType',array('id'=>$list['id']))}" onclick="edit(this)" data-toggle="tooltip" title="编辑" class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>-->
                                        <a href="javascript:edit('{$list[id]}','{$list[name]}');"   ruleName="{$list['name']}" ruleId="{$list['id']}"   data-toggle="tooltip" title="编辑" class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:del('{$list[id]}')" id="button-delete6" data-toggle="tooltip" title="删除" class="btn btn-danger" data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                
                <div class="row">
                    <div class="col-sm-6 text-left"></div>
                    <div class="col-sm-6 text-right">{$show}</div>
                </div>
          
          </div>
        </div>
      </div>
    </div>
    <!-- /.row --> 
  </section>
  <!-- /.content --> 
</div>


<div class="modal fade" id="bjy-add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">产品属性组</h4>
            </div>
            <div class="modal-body">
                <form id="bjy-form" class="form-inline" action="{:url('Admin/product/addEditProductType')}" method="post" target="_self">
                    <table class="table table-striped table-bordered table-hover table-condensed">
                        <tr>
                            <th width="15%">属性组名称：</th>
                            <td><input class="form-control" type="text" name="name" required></td>
                        </tr>
                        <tr>
                            <th></th>
                            <td><input class="btn btn-primary" type="submit" value="添加"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="bjy-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">修改属性组</h4>
            </div>
            <div class="modal-body">
                <form id="bjy-form" class="form-inline" action="{:url('Admin/product/addEditProductType')}" method="post" target="_self">
                    <input type="hidden" name="id" id="typeId">
                    <table class="table table-striped table-bordered table-hover table-condensed">
                        <tr>
                            <th width="15%">属性组名称：</th>
                            <td>
                                <input class="form-control" type="text" id="typeName" name="name" required>
                            </td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <input class="btn btn-primary" type="submit" value="修改">
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>

<script>

    // 添加菜单
    function add(){
        $("input[name='name']").val('');
        $('#bjy-add').modal('show');
    }

    // 修改菜单
    function edit(id,name){
        $("#typeId").val(id);
        $("#typeName").val(name);
        $('#bjy-edit').modal('show');
    }

    function del(id) {
        parent.layer.confirm('确定要删除?', function(){
            parent.layer.closeAll('dialog');
            $.ajax({
                url:"/index.php/Admin/Product/delProductType/id/"+id,
                success: function(v){
                    var v =  eval('('+v+')');
                    parent.layer.msg(v.msg, {icon: 1,time: 1000});
                    if(v.hasOwnProperty('status') && (v.status == 1))
                        window.location.href = location.href;
                }
            });
            return false;
        });
    }
</script>



</body>
</html>